home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / GENCSRC.ZIP / SWITCH.C < prev    next >
C/C++ Source or Header  |  1987-11-21  |  714b  |  26 lines

  1.                                          /* Chapter 3 - Program 6 */
  2. main()
  3. {
  4. int truck;
  5.  
  6.    for (truck = 3;truck < 13;truck = truck + 1) {
  7.  
  8.       switch (truck) {
  9.          case 3  : printf("The value is three\n");
  10.                    break;
  11.          case 4  : printf("The value is four\n");
  12.                    break;
  13.          case 5  :
  14.          case 6  :
  15.          case 7  :
  16.          case 8  : printf("The value is between 5 and 8\n");
  17.                    break;
  18.          case 11 : printf("The value is eleven\n");
  19.                    break;
  20.          default : printf("It is one of the undefined values\n");
  21.                    break;
  22.       } /* end of switch */
  23.  
  24.    } /* end of for loop */
  25. }
  26.